package com.example.s05_shop.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.s05_shop.mapper.UserMapper;
import com.example.s05_shop.pojo.User;
import com.example.s05_shop.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService
{

    @Autowired
    UserMapper userMapper;

    @Override
    public boolean checkName(String username)
    {
        Map<String,Object> m = new HashMap<>();
        m.put("username",username);
        List<User> results = userMapper.selectByMap(m);
        return  results.size()<1;
    }
}